package com.lam.mall.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.lam.common.base.controller.BaseController;
import com.lam.common.base.domain.Result;
import com.lam.common.base.page.TableHelper;
import com.lam.common.components.dict.annotation.DictAutoTransfer;
import com.lam.common.validate.ValidateUtil;
import com.lam.framework.annotation.ParamInject;
import com.lam.framework.operLog.annotation.Log;
import com.lam.mall.entity.OrderLog;
import com.lam.mall.param.OrderLogParam;
import com.lam.mall.service.OrderLogService;

/**
 * 订单日志Controller
 * 
 * @author admin
 * @date 2023-04-26
 */
@Log(title = "订单日志")
@ParamInject
@RestController
@RequestMapping("/${adminPath}/mall/orderLog")
public class OrderLogController extends BaseController {

    @Autowired
    private OrderLogService orderLogService;

    /**
     * 根据订单号查询
     */
    @Log(oper="根据订单号查询")
    @DictAutoTransfer
    @PreAuthorize("@ss.hasPm('mall:order:query')")
    @GetMapping("/list")
    public Result listByOrder(OrderLogParam param) {
    	
    	ValidateUtil.validRequired(param.getOrderNumber(), "订单号不能为空");
    	TableHelper.orderByColumn("create_time", "desc");
        List<OrderLog> list = orderLogService.selectList(param);
        return Result.ok(list);
    }

}
